package com.taikang.hmp.frame.common.chat;

import javax.servlet.http.HttpServletRequest;

import org.apache.catalina.websocket.StreamInbound;
import org.apache.catalina.websocket.WebSocketServlet;

/**
 * 接收ws://协议的请求
 * 
 * @author 赵春水
 */
public class SendMessageServlet extends WebSocketServlet {

	private static final long serialVersionUID = 1L;
	
	public static int ONLINE_USER_COUNT	= 1;//上线人数
	
	public String getUser(HttpServletRequest request){
		String user = (String) request.getParameter("userid");
		System.out.println("user:"+user);
		return user;
	}
	public String getType(HttpServletRequest request){
		String type = (String) request.getParameter("type");
		System.out.println("type:"+type);
		return type;
	}

	/**
	 * 初始化自定义的WebSocket连接对象
	 * 
	 * @author 赵春水
	 */
    @Override
    protected StreamInbound createWebSocketInbound(String subProtocol,HttpServletRequest request) {
        return new WebSocketMessageInbound(this.getUser(request),this.getType(request));
    }
}